package com.topone.server;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.annotation.Nullable;
import android.util.Log;

public class ServerLoginService extends Service {

    public ServerLoginService() {

    }

    /**
     * onBinder时候将服务器的ServerLoginBinder返回
     *
     * @param intent
     * @return
     */
    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return new ServerLoginBinder();
    }

    /**
     * 服务端的处理逻辑
     */
    private static class ServerLoginBinder extends ILoginAidlInterface.Stub {

        @Override
        public void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat, double aDouble, String aString) throws RemoteException {

        }

        @Override
        public boolean login(UserInfo info) throws RemoteException {
            Log.e("TAG", "server login userInfo = " + info.toString());
            if ("tom".equals(info.getName()) && "jack".equals(info.getPassword())) {
                return true;
            }
            return false;
        }


    }

}
